// 创建时间 y-mm-dd格式
export function dateFomat(time){
    let date = new Date(time)
    let year = date.getFullYear()
    let month = date.getMonth()
    if(month < 10)month = '0' +  month
    let dat = date.getDate()
    if(dat < 10)dat = '0' +  dat
    return (`${year}-${month}-${dat}`)
}

// 歌曲时长格式1
export function dtFormat(dt){
    dt = parseInt(dt)
    let minutes,second
    // 歌曲不足一分钟时
    if(dt<60000){
        second = parseInt(dt/1000)
        return '00:' + second 
    }else{
        // 分
        minutes =  parseInt(dt/60000)
        second = dt/60000 - minutes
        if(minutes < 10){
            minutes = '0' + minutes
        }
        // 秒
        second = parseInt(second * 60)
        if(second < 10){
            second = '0' + second
        }

    }
    return `${minutes}:${second}`

}

// 歌曲时长格式2
export function currentTimeFormat(time){
    var min = parseInt(time / 60),
        sec = parseInt(time % 60)
    min = min < 10 ? "0" + min : min
    sec = sec < 10 ? "0" + sec : sec
    return min + ":" + sec

}

// 歌曲播放数格式化
export function _playCountFormat(count){
    if(count > 100000000){
        return (count/100000000).toFixed(1)+'亿'
    }
    if(count > 100000){
        return parseInt(count/10000)+'万'
    }
    if(count < 100000){
        return count
    }
}

